1. Field of the Invention
The present invention relates to computer systems. More particularly, the present invention relates to opcode numbering for meta-data encoding.
2. Background
A known problem for software developers and computer users is the lack of portability of software across operating system platforms. As a response to this concern, the Java(trademark) programming language was developed at Sun Microsystems as a platform independent, object oriented computer language.
Java(trademark) achieves its operating system independence by being both a compiled and interpreted language. The way in which this independence is achieved is illustrated in FIG. 1. First, Java(trademark) source code 10, which consists of Java(trademark) classfiles, is compiled into a generic intermediate format called Java(trademark) bytecode 14. Java(trademark)""s bytecodes consist of a sequence of single byte opcodes, each of which identify a particular operation to be carried out. Additionally, some of the opcodes have parameters. For example, opcode number 21, iload  less than varnum greater than , takes the single-word integer value stored in the local variable, varnum, and pushes it onto a stack.
Next, the bytecodes 14 are interpreted by a Java(trademark) Virtual Machine (JVM) 16. The JVM executes the bytecodes, either by interpreting them or by compiling them to native machine code and then executing the compiled code. The JVM 16 is a stacked-based implementation of a xe2x80x9cvirtualxe2x80x9d processor that shares many characteristics with physical microprocessors. The bytecodes 14 executed by the JVM 16 are essentially a machine instruction set, and as will be appreciated by those of ordinary skill in the art, are similar to the assembly language of a computing machine. Accordingly, every hardware platform or operating system may have a unique implementation of the JVM 16, called a Java(trademark) Runtime System, to route the universal bytecode calls to the underlying native system 18.
Although Java(trademark) provides portability through bytecodes, Java(trademark) programs lag natively compiled programs, written in languages like C/C++, in their execution time. When a user activates a Java program on a Web Page, the user must wait not only for the program to download but also to be interpreted. To improve Java(trademark)""s execution time, optimizations can be introduced into the processing of Java(trademark) bytecodes 14. These optimizations can be implemented in a variety of manners including as Stand-Alone Optimizers (SAOs) or as part of Just-in-Time (JIT) compilers.
A SAO transforms an input classfile containing bytecode 14 into an output classfile containing bytecodes that more efficiently perform the same operations. A JIT transforms an input classfile containing bytecode 14 into an executable program. Prior to the development of JITs, a JVM 16 would step through all the bytecode instructions in a program and mechanically perform the native code calls. With a JIT compiler, however, the JVM 16 first makes a call to the JIT which compiles the instructions into native code that is then run directly on the native operating system 18. The JIT compiler permits natively complied code to run faster and makes it so that the code only needs to be compiled once. Further, JIT compilers offer a stage at which the executable code can be optimized.
Increasing demands on computers in general create an incentive to optimize the speed and efficiency of program execution. The run time nature of Java(trademark)-like systems provides a significant additional incentive for such optimizations. Accordingly, a need exists in the prior art for a method for optimizing program execution.
A method for including opcode information in an opcode includes numbering the opcode such that a property of the opcode is represented by at least one bit of the opcode. According to one aspect, the number of data units required to advance to the next opcode is encoded into the opcode value itself. According to another aspect, opcodes are numbered such that opcodes having the same properties have opcode values in the same opcode range.